package com.ruoyi.web.controller.system;

import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.model.RegisterBody;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.framework.web.service.SysForgetService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import static com.ruoyi.common.core.domain.AjaxResult.error;
import static com.ruoyi.common.core.domain.AjaxResult.success;

@RestController
public class SysForgetController {
    @Autowired
    private SysForgetService forgetService;

    @Anonymous
    @PostMapping("/forget")
    public AjaxResult register(@RequestBody RegisterBody user)
    {
        String msg = forgetService.forget(user);
        return StringUtils.hasText(msg) ? success() : error(msg);
    }
}
